package com.searchschool.bean;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity (name="SCHOOL")
@Table (name="tbschool")
public class School implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue ( strategy=GenerationType.TABLE, 
	  generator="SCHOOL_GEN")
	@TableGenerator (name="SCHOOL_GEN", table="tbsequence",
			pkColumnName="SEQ_NAME",
			valueColumnName="SEQ_COUNT",
			pkColumnValue="SCHOOL",
			allocationSize=1)
	private int idschool;
	
	@OneToOne( optional=false, fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
	@JoinColumn(name="iduser", referencedColumnName="iduser", nullable=false, insertable=true, updatable=false )
	private User user;
	
	@OneToOne( optional=false, fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
	@JoinColumn(name="idtype", referencedColumnName="idtype", nullable=false, insertable=true, updatable=false )
	private Type type;
	
	@OneToOne( optional=false, fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
	@JoinColumn(name="idorigin", referencedColumnName="idorigin", nullable=false, insertable=true, updatable=false )
	private Origin origin;
	
	@OneToOne( optional=false, fetch=FetchType.EAGER, cascade=CascadeType.PERSIST)
	@JoinColumn(name="idnet", referencedColumnName="idnet", nullable=false, insertable=true, updatable=false )
	private Net net;
	
	private String telephone;
	private String name;
	private String description;
	private String foundation;
	private String url;
	private double ranking;
	private String urlimg;

	public School() {
		super();
	}

	/**
	 * @param idschool
	 * @param user
	 * @param type
	 * @param origin
	 * @param net
	 * @param telephone
	 * @param name
	 * @param description
	 * @param foundation
	 * @param url
	 * @param ranking
	 * @param urlimg
	 */
	public School(int idschool, User user, Type type, Origin origin, Net net,
			String telephone, String name, String description,
			String foundation, String url, double ranking, String urlimg) {
		super();
		this.idschool = idschool;
		this.user = user;
		this.type = type;
		this.origin = origin;
		this.net = net;
		this.telephone = telephone;
		this.name = name;
		this.description = description;
		this.foundation = foundation;
		this.url = url;
		this.ranking = ranking;
		this.urlimg = urlimg;
	}

	/**
	 * @return the idschool
	 */
	public int getIdschool() {
		return idschool;
	}

	/**
	 * @param idschool the idschool to set
	 */
	public void setIdschool(int idschool) {
		this.idschool = idschool;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * @return the type
	 */
	public Type getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(Type type) {
		this.type = type;
	}

	/**
	 * @return the origin
	 */
	public Origin getOrigin() {
		return origin;
	}

	/**
	 * @param origin the origin to set
	 */
	public void setOrigin(Origin origin) {
		this.origin = origin;
	}

	/**
	 * @return the net
	 */
	public Net getNet() {
		return net;
	}

	/**
	 * @param net the net to set
	 */
	public void setNet(Net net) {
		this.net = net;
	}

	/**
	 * @return the telephone
	 */
	public String getTelephone() {
		return telephone;
	}

	/**
	 * @param telephone the telephone to set
	 */
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the foundation
	 */
	public String getFoundation() {
		return foundation;
	}

	/**
	 * @param foundation the foundation to set
	 */
	public void setFoundation(String foundation) {
		this.foundation = foundation;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the ranking
	 */
	public double getRanking() {
		return ranking;
	}

	/**
	 * @param ranking the ranking to set
	 */
	public void setRanking(double ranking) {
		this.ranking = ranking;
	}

	/**
	 * @return the urlimg
	 */
	public String getUrlimg() {
		return urlimg;
	}

	/**
	 * @param urlimg the urlimg to set
	 */
	public void setUrlimg(String urlimg) {
		this.urlimg = urlimg;
	}

	
}
